#pragma once

class RectElement;

#include "RectBase.h"

class RectSelect : public RectBase
{
public:
	RectSelect();
	virtual ~RectSelect();	

public:
	virtual void		Update() = 0;
	virtual void		ChangeSize();

	virtual	void		Reset()					{}
	virtual void		OffSelectRect()			{}
	virtual void		SetDestPos(int nDestPosX, int nDestPosY)			{}
	virtual void		SetClickDown() = 0;
	virtual void		SetClickUp()			{}
	virtual BOOL		IsClicked()				{ return FALSE; }
	void				SetSelect(BOOL bSel)	{ m_bSelected = bSel; }
	BOOL				IsSelected()			{ return m_bSelected; }	

protected:
	void				Create(	RectElement* pRectBase, RectElement* pRectSelect, 
								int nPosX, int nPosY, int nWidth, int nHeight);	

protected:
	RectElement*		m_pRectBase;
	RectElement*		m_pRectSelect;
	BOOL				m_bSelected;
};



class RectSelectScale : public RectSelect
{	
public:
	RectSelectScale();
	virtual ~RectSelectScale();

public:
	virtual void		Update();
	virtual	void		Reset();
	virtual void		OffSelectRect();
	virtual void		SetDestPos(int nDestPosX, int nDestPosY)	{ m_nDestPosX = nDestPosX; m_nDestPosY = nDestPosY; }	

	void				Create(	RectElement* pRectBase, RectElement* pRectSelect, 
								int nPosX, int nPosY, int nWidth, int nHeight, 
								float fmaxScale);
	void				SetTexture(const char* pPath);
	void				SetClickDown();

	BOOL				IsClicked()									{ return m_bShowSelectRect; }
	void				SetMaxScaleCounter(int nNew)				{ m_nMaxCounter = nNew; }


protected:
	float				m_fMaxScale;
	int					m_nScaleCounter;
	int					m_nMaxCounter;
	int					m_nDestPosX;
	int					m_nDestPosY;	
	BOOL				m_bShowSelectRect;

	float				m_fSelectPosX;
	float				m_fSelectPosY;
	float				m_fSelectWidth;
	float				m_fSelectHeight;	
	float				m_fSelectAlpah;
};

class RectSelectButton : public RectSelect
{	
public:
	RectSelectButton();
	virtual ~RectSelectButton();

public:
	virtual void		ChangeSize();
	virtual void		Update();
	virtual	void		Reset();

	void				Create(	RectElement* pRectBase, RectElement* pRectSelect, RectElement* pRectMouseDown, 
								int nPosX, int nPosY, int nWidth, int nHeight);
	void				SetTexture(int nIndex, const char* pPath);		
	void				SetClickDown();
	void				SetClickUp();
	BOOL				IsClicked()				{ return m_bMouseDown; }
	BOOL				IsClickUp()				{ return m_bMouseUp; }

protected:
	BOOL				m_bMouseDown;
	BOOL				m_bMouseUp;
	RectElement*		m_pRectCurDraw;
	RectElement*		m_pRectMouseDown;
};